/* Copyright (c) <2003-2022> <Julio Jerez, Newton Game Dynamics>
* 
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* 
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 
* 3. This notice may not be removed or altered from any source distribution.
*/

#ifndef _ND_BRAIN_SAVE_LOAD_H__
#define _ND_BRAIN_SAVE_LOAD_H__

#include "ndBrainStdafx.h"
#include "ndBrainLayer.h"

class ndBrain;

class ndBrainLoad: public ndClassAlloc
{
	public:
	ndBrainLoad() {}
	virtual ~ndBrainLoad() {}

	ndBrain* Load() const;
	static ndBrain* Load(const char* const pathName);

	virtual ndInt32 ReadInt() const = 0;
	virtual ndFloat32 ReadFloat() const = 0;
	virtual void ReadString(char* const buffer) const = 0;
};

class ndBrainSave: public ndClassAlloc
{
	public:
	ndBrainSave() {}
	virtual ~ndBrainSave() {}
	virtual void WriteData(const char* const data) const = 0;

	void Save(const ndBrain* const brain);
	static void Save(const ndBrain* const brain, const char* const pathName);
};

class ndSaveToFile : public ndBrainSave
{
	public:
	ndSaveToFile(const char* const pathFilename);
	virtual ~ndSaveToFile();
	virtual void WriteData(const char* const data) const;

	FILE* m_file;
};
#endif 

